package org.xxx.epms.gateway.config.common;

import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.xxx.epms.gateway.config.service.AdminDetailsService;
import java.util.HashMap;
import java.util.Map;

/**
 * @Description: 用户详情配置
 * @author: lb
 */

@Getter
@Setter
public class UserDetailsConfig {

    private Map<String, UserDetailsService> userDetailsServiceMap;

    @Autowired
    private AdminDetailsService adminDetailsService;

    private void initUserDetailsServiceMap(){
        userDetailsServiceMap = new HashMap<String, UserDetailsService>();
        userDetailsServiceMap.put("adm",this.adminDetailsService);
        //添加其他用户类型并配置UserDetailsService 用户类型取类名前三个字母
    }

    public Map<String,UserDetailsService> getUserDetailsServiceMap(){
        if(userDetailsServiceMap == null){
            initUserDetailsServiceMap();
        }
        return userDetailsServiceMap;
    }
}
